var app=getApp();
Page({
    data:{
       userInfo: {},
       __PUBLIC__:app.__PUBLIC__
    },
    onLoad:function(options){
        try {
            var value = wx.getStorageSync('PHPSESSID')
            if (value) {
            // console.log(value);
            }else{
                wx.showModal({
                  content: '当前用户未绑定，请使用账号密码登录',
                  showCancel: false,
                  success: function (res) {
                      if (res.confirm) {
                          wx.redirectTo({
                              url: '../../login/login',
                          });
                      }
                  }
                });           
            }
        }catch (e) {
            console.log(e)
        }
    },
 
    onShow:function(){
        myDate = new Date();
        Y = myDate.getFullYear();
        M = myDate.getMonth();
        m = ++ M;
        d = myDate.getDate();
        m=checkTime(m);
        d=checkTime(d);
        function checkTime(i){
            if (i<10) {
                i="0" + i
            }
            return i
        }
        this.setData({date:Y+'-'+m+'-'+d})

        var that = this;
        wx.getUserInfo({
            success: function(res) {
                that.setData({userInfo: res.userInfo})     
            }
        }) 
    },
})
